package app.engine.enums;

/**
 * @Description 走法评分器(防守)，定义不同模式的评分标准
 * @Date 2022/4/18 22:41
 * @Created by LYP
 */
public enum  MoveScoreDefenseType {
    // 防三，放两端
    THREE(3, 0, 1, 100),
    // 防三，放中间
    THREE_CEN(3, 0, 2, 100),
    // 防四， 放两端, 已经输了
    //FOUR(4, 0, 1, 1000),
    // 防四， 放中间
    FOUR_CEN(4, 0, 2, 1000),
    // 防冲四， 放两端
    FOUR_END_ONE(4, 1, 1, 1000),
    // 防五， 放中间
    FIVE_CEN(5, 0, 2, 1000),
    ;

    // 被防守的对方棋子数
    private int defChessCount;

    // 被防守对方端点的我方棋子数
    private int endCount;

    // 防守类型：1 放两端  2 防中间
    private int defType;

    private int score;

    MoveScoreDefenseType(int defChessCount, int endCount, int defType, int score) {
        this.defChessCount = defChessCount;
        this.endCount = endCount;
        this.defType = defType;
        this.score = score;
    }



    public static int matchScore(int defChessCount, int endCount, int defType) {
        MoveScoreDefenseType[] moveScoreDefenseTypes = MoveScoreDefenseType.values();
        for (MoveScoreDefenseType moveScoreDefenseType : moveScoreDefenseTypes) {
            if (moveScoreDefenseType.getDefChessCount() == defChessCount
                    && moveScoreDefenseType.getEndCount() == endCount
                    && moveScoreDefenseType.getDefType() == defType) {
                return moveScoreDefenseType.getScore();
            }
        }
        return 0;
    }

    public int getDefChessCount() {
        return defChessCount;
    }

    public int getEndCount() {
        return endCount;
    }

    public int getDefType() {
        return defType;
    }

    public int getScore() {
        return score;
    }
}
